<?php

namespace app\common\model;

use cores\BaseModel;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Model;

/**
 * 房间表
 * Class Room
 * @package app\console\model
 */
class Room extends BaseModel
{
    protected $name = 'room';

    // 表主键
    protected $pk = 'room_id';

    /**
     * 获取房间详情
     * @param int|array $where
     * @return Room|array|mixed|Model|null
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     * @noinspection PhpDynamicAsStaticMethodCallInspection
     */
    public static function detail($where)
    {
        if (is_numeric($where)) $where = array('room_id' => $where);
        return self::where($where)->find();
    }
}
